package com.gitee.mall.ware.dao;

import com.gitee.mall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 *
 * @author acao
 * @email acao@163.com
 * @date 2024-05-24 15:09:15
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    Long getSkuStock(@Param("skuId") Long skuId);

    int lockSkuStock(@Param("skuId") Long skuId, @Param("count") Integer count, @Param("wareId") Long wareId);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    int unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);
}
